<template>
    <div>
        <h1>testpost 请求体data不传参</h1>
        <button @click="postNoData">发送不传入请求体的post请求</button><br />

        学号：<input type="text" v-model="stu_id" /><br />
        姓名：<input type="text" v-model="stu_name" /><br />
        语文：<input type="text" v-model="chinese" /><br />
        数学：<input type="text" v-model="math" /><br />
        英语：<input type="text" v-model="english" /><br />
        理综：<input type="text" v-model="lizong" /><br />
        文综：<input type="text" v-model="wenzong" /><br />
        <button @click="submit">提交数据post请求</button>
    </div>
</template>

<script>
import {TestPost, testFormPost} from "../api/ajax";
export default {
    data(){
        return{
            stu_id:"",
            stu_name:"",
            chinese:0,
            math:0,
            english:0,
            lizong:0,
            wenzong:0,
        };
    },
    methods:{
        async postNoData(){
            //这个路径没有（老师的）  想用需要写一个   /studyAxiosPost
            let url = "/studyAxiosPost";
            let params = {};
            let result = await TestPost(url,params);
            console.log(result);
        },
        async submit(){
            let url = "/entry_exam";
            let data = {
                stu_id: this.stu_id,
                stu_name: this.stu_name,
                chinese: this.chinese,
                math: this.math,
                english: this.english,
                lizong: this.lizong,
                wenzong: this.wenzong,
            };
            let result = await testFormPost(url, data);
            console.log(result);
        }
    }
}
</script>

<style lang="scss" scoped>

</style>